﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Warehouse.DataAccess
{
    public partial class PaymentBill : CustomeEntity<PaymentBill>
    {
        public BillStatus BillStatus
        {
            get { return (BillStatus)this.Status; }
            set { this.Status = (int)value; }
        }

        protected override System.Linq.Expressions.Expression<Func<PaymentBill, bool>> GetPredicate()
        {
            return p => p.ID == this.ID;
        }

        #region Public Static Methods

        public static PaymentBill GetOne(Guid Id)
        {
            using (WarehouseClassesDataContext context = new WarehouseClassesDataContext())
            {
                return (from t in context.PaymentBill where t.ID == Id select t).SingleOrDefault();
            }
        }

        public static PaymentBill GetPaymentBillForPurcharseBill(Guid purcharseBillId)
        {
            return GetOne(p => p.PruchageBillID == purcharseBillId);
        }

        #endregion


    }
}
